package methodImportUse;

import java.util.ArrayList;
import java.util.Collections;
import java.util.function.Function;

public class Demo1 {
    public static void main(String[] args) {
        //方法引用
        //函数式接口,返回值和形参一致
        //方法已经存在
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list, "1", "2", "3");
        //将字符串转换成整数
        /*list.stream().map(new Function<String, Integer>() {
            @Override
            public Integer apply(String s) {
                return Integer.parseInt(s);
            }
        }).forEach(s-> System.out.println(s));*/
        list.stream().map(Integer::parseInt).forEach(System.out::println);

    }
}
